//
//  NetWorkTools.swift
//  SwiftWeiBo
//
//  Created by wyw on 16/10/9.
//  Copyright © 2016年 Style_Y. All rights reserved.
//

import UIKit
import AFNetworking

class NetWorkTools: AFHTTPSessionManager {
    
    static let tools : NetWorkTools = {
    
        // baseURL一定要以"/"结尾
        let url = URL(string: "https://api.weibo.com/")
        let t = NetWorkTools(baseURL: url)
        
        // 设置AFN能接收的数据类型
        t.responseSerializer.acceptableContentTypes = (NSSet(objects: "application/json", "text/json", "text/javascript", "text/plain") as! Set)
        
        return t
    }()
    
    // 获取单例
    class func shareNetWorkTools() -> NetWorkTools {
        return tools
    }
}
